package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 消息通知
 */
@Data
@TableName("his_message")
public class Message implements Serializable {

    @TableId
    private Long id;
    @ApiModelProperty(value = "标题",required = true)
    private String title;
    @ApiModelProperty(value = "1 订单消息 ",required = true)
    private Integer type;
    @ApiModelProperty(value = "消息关联的具体业务id",required = true)
    private String messageId;
    @ApiModelProperty(value = "消息跳转链接",required = true)
    private String msgUrl;
    @ApiModelProperty(value = "是否查看 1未查看 2已查看",required = true)
    private Integer isLook;
    @ApiModelProperty(value = "是否删除0：否 1：是",required = true)
    private Integer isDelete;

    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "药房id",required = true)
    private String pharmacyId;

    public void copy(Message source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
